package com.eimf.saf.base.querycomm;

/**
 * @author eden
 * @date 2013-11-18 下午1:42:44
 * @Description: 条件表达式
 */
public class Expression
{

    /**
     * 属性名.
     */
    private String key;

    /**
     * 属性值。
     */
    private Object value;

    /**
     * 属性值2，当使用between时，就有两个value。
     */
    private Object value2;

    /**
     * 操作符。
     */
    private OperatorEnum operatorEnum;

    public Expression(final String key, final Object value, final OperatorEnum operator)
    {
        super();
        this.key = key;
        this.value = value;
        this.operatorEnum = operator;
    }

    public Expression(final String key, final Object value)
    {
        super();
        this.key = key;
        this.value = value;
        this.operatorEnum = OperatorEnum.EQ;
    }

    /**
     * 当有两个值的时候，操作符为between
     * 
     * @param key
     * @param value
     * @param value2
     */
    public Expression(final String key, final Object value, final Object value2)
    {
        super();
        this.key = key;
        this.value = value;
        this.value2 = value2;
        this.operatorEnum = OperatorEnum.BETWEEN;
    }

    public Object getValue2()
    {
        return value2;
    }

    public void setValue2(final Object value2)
    {
        this.value2 = value2;
    }

    public String getKey()
    {
        return key;
    }

    public void setKey(final String key)
    {
        this.key = key;
    }

    public Object getValue()
    {
        return value;
    }

    public void setValue(final Object value)
    {
        this.value = value;
    }

    public OperatorEnum getOperator()
    {
        return operatorEnum;
    }

    public void setOperator(final OperatorEnum operator)
    {
        this.operatorEnum = operator;
    }
}
